/**
 * @author thuang513
 */
var mydata = new Array();


google.load("visualization", "1", {
    packages: ["columnchart"]
});

function Results(div, chartTitle){
    
    this.chart_div = div;
	this.title = chartTitle;
	

}








Results.prototype.display = function(){

    try {
        this.drawChart();
		
    } 
    catch (e) {
        alert("Error in Results.display(): " + e);
    }
}




Results.prototype.drawChart = function(){


    try {
        var data = new google.visualization.DataTable();
        
        /* Change this to our data..*/
        data.addColumn('string', 'Population');
        data.addColumn('number', populationArray[0].comparisonPoint);
        
        var dataArrLen = mydata.length;
        data.addRows(dataArrLen);
        
        try {
            for (var i = 0; i < dataArrLen; i++) {
                var barName = populationArray[i].location;
                data.setValue(i, 0, barName); // i+1 = population number
                data.setValue(i, 1, parseFloat(mydata[i]));
            }
        } 
        catch (e) {
            alert("Error in array loop: " + e);
        }
        
        
       
        var chart = new google.visualization.ColumnChart(document.getElementById(this.chart_div));
        
        chart.draw(data, {
            width: 600,
            height: 400,
            is3D: false,
			colors: ["#FF9418", "#2E3795","#2C677B", "#CF1A07", "#2A513C"],
			vAxis: {minValue: 0},
        //    title: "Comparisons"
        });
        
        
    } 
    catch (e) {
        alert("Error at drawChart: " + e);
    }
    
    /*	
     var data = new google.visualization.DataTable();
     data.addColumn('string', 'Year');
     data.addColumn('number', 'Sales');
     data.addColumn('number', 'Expenses');
     data.addRows(4);
     data.setValue(0, 0, '2004');
     data.setValue(0, 1, 1000);
     data.setValue(0, 2, 400);
     data.setValue(1, 0, '2005');
     data.setValue(1, 1, 1170);
     data.setValue(1, 2, 460);
     data.setValue(2, 0, '2006');
     data.setValue(2, 1, 660);
     data.setValue(2, 2, 1120);
     data.setValue(3, 0, '2007');
     data.setValue(3, 1, 1030);
     data.setValue(3, 2, 540);
     */
   /* try {
    
    
        var chart = new google.visualization.ColumnChart(document.getElementById(this.chart_div));
        chart.draw(data, {
            width: 600,            
            height: 400,
            title: this.title,
            hAxis: {
                title: 'Year',
                titleColor: 'red'
            },
			 colors:['blue', 'orange']
          //  vAxis.minValue: 0
        });
        
    } 
    catch (e) {
        // alert("Error in drawChart: " + e);
    }*/
}